package cn.org.tpeach.nosql.redis.enums;

import lombok.Getter;

/**
 * <p>Title: RedisStructure.java</p> 
 * @author taoyz 
 * @date 2019年6月24日 
 * @version 1.0 
*/
public enum RedisStructure {
	SINGLE(0,"cn.org.tpeach.nosql.redis.connection.impl.RedisLarkLettuceByte"),
	CLUSTER(1,"cn.org.tpeach.nosql.redis.connection.impl.RedisLarkLettuceByte"),
	UNKNOW(-1, "unknow");
	
	
	private RedisStructure(int code, String service) {
		this.code = code;
		this.service = service;
	}
	@Getter
	private int code;
	@Getter
	private String service;
	
	public static RedisStructure getRedisStructure(int code) {
		if (code == RedisStructure.SINGLE.code) {
			return RedisStructure.SINGLE;
		} else if (code == RedisStructure.CLUSTER.code) {
			return RedisStructure.CLUSTER;
		}
		return RedisStructure.UNKNOW;
	}
}
